package com.tian.code.tool;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.tian.code.tool.service.ModelBase;
import com.tian.code.tool.service.ModelBody;

import freemarker.template.Configuration;
import freemarker.template.Template;

public class FreeMarkerMain {

	public static void main(String[] args) throws Exception {
//		String templateName = "User.ftl";
//		String outPutName = "E://dust//CodeTool//config//out//User.java";
//		Configuration cfg = new Configuration();
//		cfg.setDirectoryForTemplateLoading(new File("E://dust//CodeTool//config//template//"));
//		Template t = cfg.getTemplate(templateName);
//
//		ModelBase base = new ModelBase();
//		base.setClassName("User");
//		base.setPackageName("packageName");
//		base.setTableComment("tableComment");
//		base.setTableName("tableName");
//
//		ModelBody body = new ModelBody();
//		body.setColComment("colComment");
//		body.setJavaType("long");
//		body.setMethodName("UserId");
//		body.setPropertyName("userId");
//		
//		List<ModelBody> bodys = new ArrayList<ModelBody>();
//		bodys.add(body);
//
//		Map<String, Object> root = new HashMap<String, Object>();
//		root.put("base", base);
//		root.put("bodys", bodys);
//
//		Writer out = new OutputStreamWriter(new FileOutputStream(outPutName), "UTF-8");
//		t.process(root, out);
//		out.flush();
//		out.close();

	}

}
